/**
 * 反馈详情
 *
 */
define(["app", "js/services/MessageBox", "js/services/MuseService", "js/directives/DatetimePicker", 'js/directives/UEditor'], function (app) {

    var deps = ["$scope", "$state", "MessageBox", "MuseService", "$modalInstance", "feedback"];

    function controller ($scope, $state, MessageBox, MuseService, $modalInstance, feedback) {

        var feedbackId = feedback.id;
        $scope.feedback = feedback;

        //获取数据
        $scope.getDetail = function () {
            MuseService.get(baseServices_restfulUrl + "feedback/load.json?id=" + feedbackId).success(
                function (data, status, headers, config) {
                    if (data.state == 0) {
                        $scope.feedback = data.data;
                        console.log($scope.feedback);
                    } else {
                        MessageBox.notify('获取数据失败:' + data.message);
                    }
                })
            .error(function () {
                MessageBox.error('服务器正在开小差zZZ,获取不到数据');
            });
        };
        if (feedbackId) {
            $scope.getDetail();
        }

        // 取消，返回
        $scope.close = function () {
            $modalInstance.dismiss("cancel");
        };
    }

    controller.$inject = deps;
    app.lazy.controller("FeedbackEditController", controller);
});
